package com.turing.usdtpay.mvp.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.turing.usdtpay.R;
import com.turing.usdtpay.base.BaseActivity;
import com.turing.usdtpay.mvp.fragment.MoneyFragment;
import com.turing.usdtpay.mvp.fragment.OrderManagerFragment;
import com.turing.usdtpay.mvp.view.BaseTitleView;
import com.turing.usdtpay.utils.LogUtils;


/**
 * @作者：JAY
 * @创建时间：2019/10/14 16:20
 * @描述：
 **/
public class MoneyActivity extends BaseActivity {
    private String TAG = "MoneyActivity";
    private BaseTitleView mTitle;
    private LinearLayout mRobLayount,mOrderLayout,mMoneyLayout,mAccountLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_money);
        initView();
        initTitle();
        initFragment();
    }

    private void initFragment() {
        setContainerId(R.id.base_fragment);
        addFragmentToStack(MoneyFragment.newInstance(null));
    }

    private void initTitle() {
        mTitle.setLogoShow(false);
        mTitle.setLeftShow(false);
        mTitle.setTitle("钱包");
    }

    private void initView() {
        mTitle = (BaseTitleView) findViewById(R.id.title);
        mRobLayount = (LinearLayout) findViewById(R.id.rob_layout);
        mOrderLayout = (LinearLayout) findViewById(R.id.order_layout);
        mMoneyLayout = (LinearLayout) findViewById(R.id.money_layout);
        mAccountLayout = (LinearLayout) findViewById(R.id.account_layout);
        mRobLayount.setOnClickListener(this);
        mOrderLayout.setOnClickListener(this);
        mMoneyLayout.setOnClickListener(this);
        mAccountLayout.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        if (v.getId() == mRobLayount.getId()){
            startActivity(new Intent(MoneyActivity.this,RodOrderActivity.class));
            finish();
//            addFragmentToStack(RobOrderFragment.newInstance(null));
        }else if (v.getId() == mOrderLayout.getId()){
            startActivity(new Intent(MoneyActivity.this,OrderManagerActivity.class));
            finish();
        }else if (v.getId() == mMoneyLayout.getId()){
            popBack();
            mTitle.setLogoShow(false);
        }else if (v.getId() == mAccountLayout.getId()){
            startActivity(new Intent(MoneyActivity.this,AccountActivity.class));
            finish();
        }
    }

    @Override
    protected void showTitleLogo(boolean show) {
        mTitle.setLogoShow(show);
    }

    @Override
    protected void setOnClickTitleLogo(View.OnClickListener listener) {
        mTitle.setOnClickLogo(listener);
    }

    @Override
    protected void setTitle(String title) {
        mTitle.setTitle(title);
    }

    @Override
    protected void showBackBtn(boolean show) {
        mTitle.setLeftShow(show);
    }

    @Override
    protected void setBackListener(View.OnClickListener listener) {
        mTitle.setLeftButtonListener(listener);
    }
}
